
#include "any.h"

#include <typeinfo>
#include <utility>

any::any ( void )
: value_ ( NULL )
{

}


any::any ( const any & other )
: value_ ( other.value_ ? other.value_->clone() : NULL )
{

}


any::~any ( void )
{
	delete value_;
}


any & any::swap ( any & rhs )
{
	std::swap ( value_, rhs.value_ ) ;
	return *this;
}


any & any::operator= ( const any & rhs )
{
	any ( rhs ).swap ( *this ) ;
	return *this;
}


bool any::empty ( void ) const
{
	return !value_;
}

const std::type_info & any::type ( void ) const
{
	return value_ ? value_->type() : typeid(void);
}